package com.breaker.kata.leetcode;

public class DeleteDuplicates {

    public int removeDuplicates(int[] nums) {
        if (nums.length <= 1) {
            return 1;
        }
        int start = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] != nums[start - 1]) {
                nums[start] = nums[i];
                start++;
            }
        }
        return start;
    }
}
